<?php

namespace App\Http\Controllers\Api;

use App\Model\AdminLog;
use App\Model\FriendsReport;
use App\Model\OperationLogs;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;

class FriendsReportController extends BaseController
{
    public function __construct(Request $request, FriendsReport $friendsReport)
    {
        parent::__construct($request);
        $this->model = $friendsReport;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {

        return $this->toJson(self::SUCCESS, $this->model->getList($request));
    }


    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $data = array_merge($request->only('dispose_desc'), ['dispose' => 1,'id'=>$id]);
        $res = $this->model->updateData($data);
        if($res['code'] !== 0){
            return $this->toJson(self::ERROR, $res);
        }
        OperationLogs::createData($request,OperationLogs::FRIENDS_REPORT, '处理', $id);

        return $this->toJson(self::SUCCESS,$res);
    }
}
